ALMaSS  1.0
The Animal, Landscape and Man Simulation System
GooseActiveForageLocation Class Reference

A class to hold an active goose foraging location and the number of birds of different types there. More...

#include <Goose_Population_Manager.h>

Public Member Functions

 GooseActiveForageLocation (GooseSpeciesType a_type, int a_number, int a_polyref, int a_area, double a_graindensity, double a_maizedensity, double *a_grazing, Goose_Population_Manager *p_NPM)
 Constructor for GooseActiveForageLocation. More...
 
void SetArea (int a_area)
 Set the area in m. More...
 
double GetArea ()
 Get the area in m. More...
 
int GetPolygonref ()
 Get the landscape element ( LE ) reference number used by the Landscape class to identify this location. More...
 
int GetMaxBirdsPresent ()
 Sum of the maximum of all geese present (this may not be the same as the real maximum) More...
 
int GetMaxSpBirdsPresent (GooseSpecies a_goose)
 Sum of the maximum of each goose species present (this may not be the same as the real maximum) More...
 
void SetPolygonref (int a_polyref)
 Set the landscape element ( LE ) reference number used by the Landscape class to identify this location. More...
 
int GetHuntables (void)
 Returns the number of huntable birds at the location. More...
 
int GetGooseNumbers (void)
 Returns the total number of geese at the location. More...
 
double GetGooseDensity (void)
 Returns the density of geese at the location. More...
 
int GetBirds (GooseSpeciesType a_type)
 Get how many birds of a type. More...
 
int GetBirds (GooseSpecies a_goose)
 Get how many birds of a species. More...
 
void AddGeese (GooseSpeciesType a_type, int a_number)
 Adds geese to the location. More...
 
void RemoveGeese (GooseSpeciesType a_type, int a_number)
 Removes geese to the location. More...
 
double GetGrainDensity (void)
 Returns the current forage density (grain/m2) More...
 
void SetGrainDensity (double a_density)
 Sets forage density (grain/m2) More...
 
double GetMaizeDensity (void)
 Returns the current maize forage density (kJ/m2) More...
 
bool GetHabitatType (void)
 Returns whether the current crop is a cereal. More...
 
void SetMaizeDensity (double a_density)
 Sets maize forage density (kJ/m2) More...
 
double GetGrazing (int gs)
 Returns the current forage rate kJ/min assuming no other geese affect this. More...
 
double GetRoostDist (int gs)
 Returns the distance to the closest roost for gs. More...
 
double GetGrazedBiomass (void)
 Returns the current grazing forage eaten in g. More...
 
void SetGrazing (int gs, double a_density)
 Sets forage density (kJ/m2) More...
 
void SetDistToClosestRoost (int gs, double a_dist)
 Sets the distance to the closest roost in meters. More...
 
void ResetGrazing ()
 Sets grazed biomass to zero. More...
 
void RemoveGrainKJ (double a_kJ)
 Removes grain from the field as kJ.
More...
 
void RemoveMaizeKJ (double a_kJ)
 Removes maize from the field as kJ. More...
 
void Graze (double a_kJ)
 Records forage removed as kJ from the field as grams. More...
 
void ClearBirds ()
 Empties the bird recording arrays. More...
 
void UpdateKJ ()
 Updates the grain or maize density based on the current total grain or maize amount. More...
 

Protected Attributes

int m_polygonref
 A landscape element ( LE ) reference number used by the Landscape class to identify this location. More...
 
double m_area
 The area of feeding location. More...
 
double m_graindensity
 The grain density in kJ/m2. More...
 
double m_maizedensity
 The maize density in kJ/m2. More...
 
double m_grazingrate [gs_foobar]
 The grazing intake rate in kJ/min. More...
 
double m_grazedbiomass
 Contains the total amount of grazing eaten today. More...
 
double m_grainKJ_total
 The total grain kJ. More...
 
double m_maizeKJ_total
 The total maize kJ. More...
 
TTypeOfMaxIntakeSource m_HabitatType
 Whether it is a cereal crop, grass etc. More...
 
int m_BirdsPresent [gst_foobar]
 An array holding the number of geese of different type i.e. Pinkfoot families, juvs, Barnacle families, juvs, Greylag familes, juvs. More...
 
int m_MaxBirdsPresent [gst_foobar]
 An array holding the maximum number of geese of different types and total i.e. Pinkfoot families, juvs, Barnacle families, juvs, Greylag familes, juvs present on the field at one time for each day. More...
 
double m_dist_to_closest_roost [gs_foobar]
 An array holding the distance to the closest roost. More...
 
Goose_Population_Managerm_OurPopulationManager
 This is a time saving pointer to the correct population manager object. More...
 

Detailed Description

A class to hold an active goose foraging location and the number of birds of different types there.

Constructor & Destructor Documentation

◆ GooseActiveForageLocation()

GooseActiveForageLocation::GooseActiveForageLocation ( GooseSpeciesType  a_type,
int  a_number,
int  a_polyref,
int  a_area,
double  a_graindensity,
double  a_maizedensity,
double *  a_grazing,
Goose_Population_Manager p_NPM 
)

Constructor for GooseActiveForageLocation.

The grain density is measured in number of grains. To go from grains to grams we use the weight of a grain being 0.04

17.67 kJ/g dw grain & 0.04 grain/g

441  {
443  SetPolygonref(a_polyref);
444  SetArea(a_area);
445  SetGrainDensity(a_graindensity); // grain/m2
446  SetMaizeDensity(a_maizedensity); // kJ/m2
451  m_grainKJ_total = a_area * a_graindensity * 17.67 * 0.04;
452  m_maizeKJ_total = a_area * a_maizedensity; // Already in kJ/m2
453  for (int i = 0; i < gs_foobar; i++)
454  {
455  SetGrazing(i, a_grazing[i]);
456  }
457  for (int i = 0; i < gst_foobar; i++)
458  {
459  m_BirdsPresent[i] = 0;
460  m_MaxBirdsPresent[i] = 0;
461  }
462  UpdateKJ(); // Scales m_xxxxKJ_total to area. Used also when recalculating after consumption by geese.
463  AddGeese(a_type, a_number);
464  m_OurPopulationManager = p_NPM;
465 }
@ gst_foobar
Definition: Goose_Base.h:66
@ tomis_foobar
Definition: Goose_Base.h:96
void SetGrainDensity(double a_density)
Sets forage density (grain/m2)
Definition: Goose_Population_Manager.h:308
double m_maizeKJ_total
The total maize kJ.
Definition: Goose_Population_Manager.h:145
void SetArea(int a_area)
Set the area in m.
Definition: Goose_Population_Manager.h:180
int m_BirdsPresent[gst_foobar]
An array holding the number of geese of different type i.e. Pinkfoot families, juvs,...
Definition: Goose_Population_Manager.h:155
void SetGrazing(int gs, double a_density)
Sets forage density (kJ/m2)
Definition: Goose_Population_Manager.h:349
double m_grainKJ_total
The total grain kJ.
Definition: Goose_Population_Manager.h:140
void SetPolygonref(int a_polyref)
Set the landscape element ( LE ) reference number used by the Landscape class to identify this locati...
Definition: Goose_Population_Manager.h:225
void UpdateKJ()
Updates the grain or maize density based on the current total grain or maize amount.
Definition: Goose_Population_Manager.h:382
Goose_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Goose_Population_Manager.h:169
void AddGeese(GooseSpeciesType a_type, int a_number)
Adds geese to the location.
Definition: Goose_Population_Manager.h:277
void SetMaizeDensity(double a_density)
Sets maize forage density (kJ/m2)
Definition: Goose_Population_Manager.h:327
int m_MaxBirdsPresent[gst_foobar]
An array holding the maximum number of geese of different types and total i.e. Pinkfoot families,...
Definition: Goose_Population_Manager.h:161
TTypeOfMaxIntakeSource m_HabitatType
Whether it is a cereal crop, grass etc.
Definition: Goose_Population_Manager.h:150

References AddGeese(), gst_foobar, m_BirdsPresent, m_grainKJ_total, m_HabitatType, m_maizeKJ_total, m_MaxBirdsPresent, m_OurPopulationManager, SetArea(), SetGrainDensity(), SetGrazing(), SetMaizeDensity(), SetPolygonref(), tomis_foobar, and UpdateKJ().

Member Function Documentation

◆ AddGeese()

void GooseActiveForageLocation::AddGeese ( GooseSpeciesType  a_type,
int  a_number 
)
inline

Adds geese to the location.

278  {
279  m_BirdsPresent[(int)a_type] += a_number;
280  if (m_BirdsPresent[(int)a_type] > m_MaxBirdsPresent[(int)a_type])
281  {
282  m_MaxBirdsPresent[(int)a_type] = m_BirdsPresent[(int)a_type];
283  }
284  }

References m_BirdsPresent, and m_MaxBirdsPresent.

Referenced by GooseActiveForageLocation().

◆ ClearBirds()

void GooseActiveForageLocation::ClearBirds ( )

Empties the bird recording arrays.

469 {
470  for (int i = 0; i < gst_foobar; i++)
471  {
472  if (m_BirdsPresent[i] != 0)
473  {
474  g_land->Warn("GooseActiveForageLocation::ClearBirds() - still birds on field", "");
475  std::exit(1);
476  break;
477  }
478  m_MaxBirdsPresent[i] = 0;
479  }
480 }
Landscape * g_land
This pointer provides access the to landscape module.
Definition: skylarks_all.cpp:49
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579

References g_land, gst_foobar, m_BirdsPresent, m_MaxBirdsPresent, and Landscape::Warn().

◆ GetArea()

double GooseActiveForageLocation::GetArea ( void  )
inline

Get the area in m.

185 { return m_area; }
double m_area
The area of feeding location.
Definition: Goose_Population_Manager.h:115

References m_area.

◆ GetBirds() [1/2]

int GooseActiveForageLocation::GetBirds ( GooseSpecies  a_goose)
inline

Get how many birds of a species.

256  {
257  int sum = 0;
258  switch (a_goose) {
259  case gs_Pinkfoot:
261  break;
262  case gs_Barnacle:
264  break;
265  case gs_Greylag:
267  break;
268  default:
269  return -1;
270  }
271  return sum;
272  }
@ gst_GreylagFamilyGroup
Definition: Goose_Base.h:64
@ gst_BarnacleFamilyGroup
Definition: Goose_Base.h:62
@ gst_GreylagNonBreeder
Definition: Goose_Base.h:65
@ gst_PinkfootFamilyGroup
Definition: Goose_Base.h:60
@ gst_PinkfootNonBreeder
Definition: Goose_Base.h:61
@ gst_BarnacleNonBreeder
Definition: Goose_Base.h:63
int GetBirds(GooseSpeciesType a_type)
Get how many birds of a type.
Definition: Goose_Population_Manager.h:251

References GetBirds(), gst_BarnacleFamilyGroup, gst_BarnacleNonBreeder, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, and gst_PinkfootNonBreeder.

◆ GetBirds() [2/2]

int GooseActiveForageLocation::GetBirds ( GooseSpeciesType  a_type)
inline

Get how many birds of a type.

251 { return m_BirdsPresent[(int)a_type]; }

References m_BirdsPresent.

Referenced by GetBirds().

◆ GetGooseDensity()

double GooseActiveForageLocation::GetGooseDensity ( void  )
inline

Returns the density of geese at the location.

Todo:
Testing a new implementation which uses flock size and not density.
243  {
244  //return GetGooseNumbers() / m_area;
245  return GetGooseNumbers();
246  }
int GetGooseNumbers(void)
Returns the total number of geese at the location.
Definition: Goose_Population_Manager.h:232

References GetGooseNumbers().

◆ GetGooseNumbers()

int GooseActiveForageLocation::GetGooseNumbers ( void  )
inline

Returns the total number of geese at the location.

232  {
233  int sum = 0;
234  for (int i = 0; i < gst_foobar; i++) {
235  sum += m_BirdsPresent[ i ];
236  }
237  return sum;
238  }

References gst_foobar, and m_BirdsPresent.

Referenced by GetGooseDensity().

◆ GetGrainDensity()

double GooseActiveForageLocation::GetGrainDensity ( void  )
inline

Returns the current forage density (grain/m2)

303 { return m_graindensity; }
double m_graindensity
The grain density in kJ/m2.
Definition: Goose_Population_Manager.h:120

References m_graindensity.

Referenced by Goose_Base::st_ChooseForageLocation().

◆ GetGrazedBiomass()

double GooseActiveForageLocation::GetGrazedBiomass ( void  )
inline

Returns the current grazing forage eaten in g.

344 { return m_grazedbiomass; }
double m_grazedbiomass
Contains the total amount of grazing eaten today.
Definition: Goose_Population_Manager.h:135

References m_grazedbiomass.

◆ GetGrazing()

double GooseActiveForageLocation::GetGrazing ( int  gs)
inline

Returns the current forage rate kJ/min assuming no other geese affect this.

334 { return m_grazingrate[gs]; }
double m_grazingrate[gs_foobar]
The grazing intake rate in kJ/min.
Definition: Goose_Population_Manager.h:130

References m_grazingrate.

Referenced by Goose_Base::st_ChooseForageLocation().

◆ GetHabitatType()

bool GooseActiveForageLocation::GetHabitatType ( void  )
inline

Returns whether the current crop is a cereal.

320  {
321  return m_HabitatType;
322  }

References m_HabitatType.

◆ GetHuntables()

int GooseActiveForageLocation::GetHuntables ( void  )

Returns the number of huntable birds at the location.

484 {
485  int huntables = 0;
488  }
491  }
492  return huntables;
493 }
bool InGreylagSeason()
Are we in the greylag hunting season?
Definition: Goose_Population_Manager.h:420
bool InPinkfootSeason()
Are we in the pinkfoot hunting season?
Definition: Goose_Population_Manager.h:418

References gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, gst_PinkfootNonBreeder, Goose_Population_Manager::InGreylagSeason(), Goose_Population_Manager::InPinkfootSeason(), m_BirdsPresent, and m_OurPopulationManager.

◆ GetMaizeDensity()

double GooseActiveForageLocation::GetMaizeDensity ( void  )
inline

Returns the current maize forage density (kJ/m2)

313  {
314  return m_maizedensity;
315  }
double m_maizedensity
The maize density in kJ/m2.
Definition: Goose_Population_Manager.h:125

References m_maizedensity.

Referenced by Goose_Base::st_ChooseForageLocation().

◆ GetMaxBirdsPresent()

int GooseActiveForageLocation::GetMaxBirdsPresent ( )
inline

Sum of the maximum of all geese present (this may not be the same as the real maximum)

196  {
197  int sum=0;
198  for (int i = (int) 0; i<gst_foobar;i++)
199  sum+=m_MaxBirdsPresent[i];
200  return sum;
201  }

References gst_foobar, and m_MaxBirdsPresent.

◆ GetMaxSpBirdsPresent()

int GooseActiveForageLocation::GetMaxSpBirdsPresent ( GooseSpecies  a_goose)
inline

Sum of the maximum of each goose species present (this may not be the same as the real maximum)

206  {
207  int sum = 0;
208  switch (a_goose) {
209  case gs_Pinkfoot:
211  break;
212  case gs_Barnacle:
214  break;
215  case gs_Greylag:
217  break;
218  default:
219  return -1;
220  }
221  return sum;
222  }

References gst_BarnacleFamilyGroup, gst_BarnacleNonBreeder, gst_GreylagFamilyGroup, gst_GreylagNonBreeder, gst_PinkfootFamilyGroup, gst_PinkfootNonBreeder, and m_MaxBirdsPresent.

◆ GetPolygonref()

int GooseActiveForageLocation::GetPolygonref ( )
inline

Get the landscape element ( LE ) reference number used by the Landscape class to identify this location.

190 { return m_polygonref; }
int m_polygonref
A landscape element ( LE ) reference number used by the Landscape class to identify this location.
Definition: Goose_Population_Manager.h:110

References m_polygonref.

Referenced by Goose_Base::st_ChooseForageLocation(), and Goose_Population_Manager::XYDump().

◆ GetRoostDist()

double GooseActiveForageLocation::GetRoostDist ( int  gs)
inline

Returns the distance to the closest roost for gs.

339 { return m_dist_to_closest_roost[gs]; }
double m_dist_to_closest_roost[gs_foobar]
An array holding the distance to the closest roost.
Definition: Goose_Population_Manager.h:165

References m_dist_to_closest_roost.

◆ Graze()

void GooseActiveForageLocation::Graze ( double  a_kJ)
inline

Records forage removed as kJ from the field as grams.

3.5 kJ/gram ww; Robbins 1993

372  {
373  m_grazedbiomass += a_kJ * 0.2857;
374  }

References m_grazedbiomass.

◆ RemoveGeese()

void GooseActiveForageLocation::RemoveGeese ( GooseSpeciesType  a_type,
int  a_number 
)
inline

Removes geese to the location.

289  {
290  m_BirdsPresent[a_type] -= a_number;
291 #ifdef __DEBUG_GOOSE
292  if (m_BirdsPresent[a_type]<0)
293  {
294  g_msg->Warn("GooseActiveForageLocation::RemoveGeese - Negative birds at forage location", (double)m_BirdsPresent[a_type]);
295  exit(0);
296  }
297 #endif
298  }
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
class MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41

References g_msg, m_BirdsPresent, and MapErrorMsg::Warn().

◆ RemoveGrainKJ()

void GooseActiveForageLocation::RemoveGrainKJ ( double  a_kJ)
inline

Removes grain from the field as kJ.

359 { m_grainKJ_total -= a_kJ; }

References m_grainKJ_total.

◆ RemoveMaizeKJ()

void GooseActiveForageLocation::RemoveMaizeKJ ( double  a_kJ)
inline

Removes maize from the field as kJ.

365  {
366  m_maizeKJ_total -= a_kJ;
367  }

References m_maizeKJ_total.

◆ ResetGrazing()

void GooseActiveForageLocation::ResetGrazing ( )
inline

Sets grazed biomass to zero.

356 { m_grazedbiomass = 0.0; }

References m_grazedbiomass.

Referenced by Goose_Population_Manager::NewForageLocation().

◆ SetArea()

void GooseActiveForageLocation::SetArea ( int  a_area)
inline

Set the area in m.

180 { m_area = a_area; }

References m_area.

Referenced by GooseActiveForageLocation().

◆ SetDistToClosestRoost()

void GooseActiveForageLocation::SetDistToClosestRoost ( int  gs,
double  a_dist 
)
inline

Sets the distance to the closest roost in meters.

351 { m_dist_to_closest_roost[gs] = a_dist; }

References m_dist_to_closest_roost.

Referenced by Goose_Population_Manager::NewForageLocation().

◆ SetGrainDensity()

void GooseActiveForageLocation::SetGrainDensity ( double  a_density)
inline

Sets forage density (grain/m2)

308 { m_graindensity = a_density; }

References m_graindensity.

Referenced by GooseActiveForageLocation().

◆ SetGrazing()

void GooseActiveForageLocation::SetGrazing ( int  gs,
double  a_density 
)
inline

Sets forage density (kJ/m2)

349 { m_grazingrate[gs] = a_density; }

References m_grazingrate.

Referenced by GooseActiveForageLocation().

◆ SetMaizeDensity()

void GooseActiveForageLocation::SetMaizeDensity ( double  a_density)
inline

Sets maize forage density (kJ/m2)

327  {
328  m_maizedensity = a_density;
329  }

References m_maizedensity.

Referenced by GooseActiveForageLocation().

◆ SetPolygonref()

void GooseActiveForageLocation::SetPolygonref ( int  a_polyref)
inline

Set the landscape element ( LE ) reference number used by the Landscape class to identify this location.

225 { m_polygonref = a_polyref; }

References m_polygonref.

Referenced by GooseActiveForageLocation().

◆ UpdateKJ()

void GooseActiveForageLocation::UpdateKJ ( )
inline

Updates the grain or maize density based on the current total grain or maize amount.

17.67 kJ/g dw grain & 0.04 g/grain

382  {
383  m_graindensity = (m_grainKJ_total / m_area) / 17.67 / 0.04;
385  }

References m_area, m_graindensity, m_grainKJ_total, m_maizedensity, and m_maizeKJ_total.

Referenced by GooseActiveForageLocation().

Member Data Documentation

◆ m_area

double GooseActiveForageLocation::m_area
protected

The area of feeding location.

Referenced by GetArea(), SetArea(), and UpdateKJ().

◆ m_BirdsPresent

int GooseActiveForageLocation::m_BirdsPresent[gst_foobar]
protected

An array holding the number of geese of different type i.e. Pinkfoot families, juvs, Barnacle families, juvs, Greylag familes, juvs.

Referenced by AddGeese(), ClearBirds(), GetBirds(), GetGooseNumbers(), GetHuntables(), GooseActiveForageLocation(), and RemoveGeese().

◆ m_dist_to_closest_roost

double GooseActiveForageLocation::m_dist_to_closest_roost[gs_foobar]
protected

An array holding the distance to the closest roost.

Referenced by GetRoostDist(), and SetDistToClosestRoost().

◆ m_graindensity

double GooseActiveForageLocation::m_graindensity
protected

The grain density in kJ/m2.

Referenced by GetGrainDensity(), SetGrainDensity(), and UpdateKJ().

◆ m_grainKJ_total

double GooseActiveForageLocation::m_grainKJ_total
protected

The total grain kJ.

Referenced by GooseActiveForageLocation(), RemoveGrainKJ(), and UpdateKJ().

◆ m_grazedbiomass

double GooseActiveForageLocation::m_grazedbiomass
protected

Contains the total amount of grazing eaten today.

Referenced by GetGrazedBiomass(), Graze(), and ResetGrazing().

◆ m_grazingrate

double GooseActiveForageLocation::m_grazingrate[gs_foobar]
protected

The grazing intake rate in kJ/min.

Referenced by GetGrazing(), and SetGrazing().

◆ m_HabitatType

TTypeOfMaxIntakeSource GooseActiveForageLocation::m_HabitatType
protected

Whether it is a cereal crop, grass etc.

Referenced by GetHabitatType(), and GooseActiveForageLocation().

◆ m_maizedensity

double GooseActiveForageLocation::m_maizedensity
protected

The maize density in kJ/m2.

Referenced by GetMaizeDensity(), SetMaizeDensity(), and UpdateKJ().

◆ m_maizeKJ_total

double GooseActiveForageLocation::m_maizeKJ_total
protected

The total maize kJ.

Referenced by GooseActiveForageLocation(), RemoveMaizeKJ(), and UpdateKJ().

◆ m_MaxBirdsPresent

int GooseActiveForageLocation::m_MaxBirdsPresent[gst_foobar]
protected

An array holding the maximum number of geese of different types and total i.e. Pinkfoot families, juvs, Barnacle families, juvs, Greylag familes, juvs present on the field at one time for each day.

Referenced by AddGeese(), ClearBirds(), GetMaxBirdsPresent(), GetMaxSpBirdsPresent(), and GooseActiveForageLocation().

◆ m_OurPopulationManager

Goose_Population_Manager* GooseActiveForageLocation::m_OurPopulationManager
protected

This is a time saving pointer to the correct population manager object.

Referenced by GetHuntables(), and GooseActiveForageLocation().

◆ m_polygonref

int GooseActiveForageLocation::m_polygonref
protected

A landscape element ( LE ) reference number used by the Landscape class to identify this location.

Referenced by GetPolygonref(), and SetPolygonref().


The documentation for this class was generated from the following files: